
package com.phevos.usercenter.client.service;

import java.net.MalformedURLException;
import java.rmi.Naming;
import java.rmi.RemoteException;
import java.rmi.registry.LocateRegistry;

public class RMIconfig
{

    //private static HashMap rmiMap = new HashMap();

    private static RMIconfig rmiConfig;

    private RMIconfig()
    {

    }

    public static RMIconfig getInstance()
    {
        if (rmiConfig == null)
        {
            rmiConfig = new RMIconfig();
        }
        return rmiConfig;
    }

    public void setRMI(String rmi, IRMIObject rmiObject, int port) throws RemoteException, MalformedURLException
    {
        // System.setProperty("java.security.policy", "server.policy");
        // if (System.getSecurityManager() == null) {
        // System.setSecurityManager(new RMISecurityManager());
        // }
        LocateRegistry.createRegistry(port);
        Naming.rebind(rmi, rmiObject);
    }
}
